home *** CD-ROM | disk | FTP | other *** search
- class FPUI.Tree extends FPUI.SelectableList
- {
- function Tree()
- {
- var _loc1_ = this;
- super();
- _loc1_._x = Math.round(_loc1_._x);
- _loc1_._y = Math.round(_loc1_._y);
- _loc1_.m_width = _loc1_._width;
- _loc1_.m_height = _loc1_._height;
- _loc1_._yscale = _loc1_._xscale = 100;
- _loc1_.setSize(_loc1_.m_width,_loc1_.m_height);
- }
- function refresh()
- {
- this.refreshBranch(-1);
- }
- function refreshBranch(index)
- {
- var _loc1_ = this;
- _loc1_.m_dataProvider.updateBranch(index);
- _loc1_.rebuildSelectedItems();
- _loc1_.invalidate("updateControl");
- }
- function setDataProvider(dataProvider)
- {
- var _loc1_ = this;
- _loc1_.clearSelected();
- super.setDataProvider(dataProvider);
- _loc1_.resetTreeWidth();
- _loc1_.refresh();
- }
- function setSize(w, h)
- {
- super.setSize(w,h);
- this.setMinHighlightWidth(Stage.width);
- }
- function moveSelBy(incr)
- {
- var _loc1_ = this.getSelectedItem();
- if(_loc1_ != null && _loc1_.isOnOpenBranch())
- {
- super.moveSelBy(incr);
- }
- this.executeCallBack();
- }
- function resetTreeWidth()
- {
- var _loc1_ = this;
- _loc1_.m_virtualWidth = _loc1_.m_dataProvider.calcWidth();
- _loc1_.setMinHighlightWidth(Stage.width);
- _loc1_.invalidate("updateControl");
- }
- function setMinTreeWidth(w)
- {
- var _loc1_ = this;
- if(w > _loc1_.m_virtualWidth)
- {
- _loc1_.m_virtualWidth = w;
- _loc1_.setMinHighlightWidth(_loc1_.m_virtualWidth);
- _loc1_.invalidate("initScrollBar");
- }
- }
- function setMinHighlightWidth(width)
- {
- var _loc2_ = this;
- var _loc3_ = width;
- var _loc1_ = 0;
- while(_loc1_ < _loc2_.m_numDisplayed)
- {
- _loc2_.getNthSelectableItem(_loc1_).setMinHighlightWidth(_loc3_);
- _loc1_ = _loc1_ + 1;
- }
- }
- function onComponentKeyDown()
- {
- var _loc2_ = this;
- if(_loc2_.m_focused && _loc2_.m_enable)
- {
- if(Key.isDown(32))
- {
- var _loc1_ = _loc2_.getSelectedItem();
- if(_loc1_ != null && _loc1_.isBranch())
- {
- _loc1_.setIsOpen(!_loc1_.isOpen());
- _loc2_.refreshBranch(_loc2_.getSelectedIndex());
- }
- }
- else
- {
- super.onComponentKeyDown();
- }
- }
- }
- function getItemSymbolName()
- {
- return "FPUI_TreeSelectableItem";
- }
- }
-